<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use DB;

class DbController extends Controller
{
    public function getList()
    {
        //查询表 取全部数据
        //$res = DB::table('photos')->get();

        //  取一条 id升续
        //$res = DB::table('photos')->first();
        //
        $res = DB::table('photos')->where('id','>',10)->get();
        
        return view('test.blog',['photos'=>$res]);
    }


    public function getUpdate()
    {
        $res = DB::table('photos')->where('id',14)->update(['name'=>'pic14__update','intro'=>'mm']);

        dd($res);
    }


   public function getInsert()
   {
    $data=['name'=>'test02','src'=>'abc.jpg'];
    $res = DB::table('photos')->insertGetId($data);
    dd($res);
   }

   public function getDel($id)
   {
    $res = DB::table('photos')->where('id',$id)->delete();
    dd($res);
   }

}
